import requests
'''
获取两点间的开车时间

BaduAPI文档：
https://lbsyun.baidu.com/index.php?title=webapi/route-matrix-api-v2
'''

#设置参数
param = {'output':'xml',
        'origins':'40.45,116.34|40.54,116.35',
        'destinations':'40.34,116.45',
        'ak':'百度开发者密码'}
url = 'https://api.map.baidu.com/routematrix/v2/driving?'

res = requests.get(url,param)

print(res.text)